package com.zhanghaijun.createCode;



import com.zhanghaijun.createCode.util.DateUtil;
import com.zhanghaijun.createCode.util.PrintUtil;
import com.zhanghaijun.createCode.util.PropsUtils;

import java.io.File;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Hello world!
 */
public class App {

    public static void main(String[] args)throws Exception {
       PrintUtil.println("sadasdas%".substring(0,"sadasdas%".length()-1));

    }

    public static long getThisMonthBeginTime(){
        Calendar cal = Calendar.getInstance();
        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);

        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
        return (cal.getTime().getTime()/1000)*1000;
    }

    private static void oneHourTime(){
        Calendar can = Calendar.getInstance();
        can.add(Calendar.MINUTE, -60);
        System.out.println(can.getTime().getTime());
    }

    private static void oneMonthAgo(){
        Calendar can = Calendar.getInstance();
        can.add(Calendar.DATE, -31);
        System.out.println(can.getTime().getTime());
    }



    private static void lastDayStartTime(){
        Calendar can = Calendar.getInstance();
        can.add(Calendar.DATE, -1);
        can.set(Calendar.HOUR_OF_DAY, 0);
        can.set(Calendar.MINUTE, 0);
        can.set(Calendar.SECOND, 0);
        System.out.println(can.getTime().getTime());
    }

    private static void lastDayEndTime(){
        Calendar can = Calendar.getInstance();
        can.add(Calendar.DATE, -1);
        can.set(Calendar.HOUR_OF_DAY,23);
        can.set(Calendar.MINUTE, 59);
        can.set(Calendar.SECOND, 59);
        System.out.println(can.getTime().getTime());
    }

    public static void thisWeekBeginTime(){
        Calendar currentDate = Calendar.getInstance();
        currentDate.setFirstDayOfWeek(Calendar.MONDAY);
        currentDate.set(Calendar.HOUR_OF_DAY, 0);
        currentDate.set(Calendar.MINUTE, 0);
        currentDate.set(Calendar.SECOND, 0);
        currentDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        System.out.println(currentDate.getTime().getTime());
    }

    public static void thisMonthBeginTime(){
        Calendar cal = Calendar.getInstance();
        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
        System.out.println(cal.getTime().getTime());
    }





//    Calendar c1 = new GregorianCalendar();
//
//    System.out.println(c1.getTime().toLocaleString());
//    Calendar c2 = new GregorianCalendar();
//    c2.set(Calendar.HOUR_OF_DAY, 23);
//    c2.set(Calendar.MINUTE, 59);
//    c2.set(Calendar.SECOND, 59);
//    System.out.println(c2.getTime().toLocaleString());















}


